<template>
    <el-table-column :label="label" :width="width">
        <template v-if="scope.row[startKey]&&scope.row[endKey]" slot-scope="scope">
            <span>{{timeFormat(scope.row[startKey])}}</span>
            <span> 至 </span>
            <span>{{timeFormat(scope.row[endKey])}}</span>
        </template>
    </el-table-column>
</template>

<script>
    import moment from "moment";

    export default {
        name: "TimeGapColumn",
        props:{
            startKey:{
                type:String,
                require:true,
            },
            endKey:{
                type: String,
                require:true,
            },
            label:String,
            width:String,
        },
        methods:{
            timeFormat(time){
                return moment(time).format('YYYY-MM-DD');
            },
        }
    }
</script>

<style scoped>

</style>